<%= javascript_include_tag "ckeditor/init" %>


<%= form_for(@article) do |f| %>
  <% if @article.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
      <ul>
      	<% @article.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :title %><br>
    <%= f.text_field :title %>
  </div>
  <div class="field">
    <%= f.label :location %><br>
    <%= f.text_field :location %>
  </div>
  <div class="field">
    <%= f.label "Categories" %><br>
    <% Category.all.each do |category| %>
      <%= check_box_tag 'article[category_ids][]', category.id,
      		@article.category_ids.include?(category.id), id: dom_id(category) %>
      <%= label_tag dom_id(category), category.name, class: 'check_box_label' %>
    <% end %>
  </div>
  <div class="field">
    <%= f.label :excerpt %><br>
    <%= f.text_field :excerpt %>
  </div>
  <div class="field">
    <%#= f.label :body %>
  </div>
  <div>
  	<%= f.text_area :body, :class => "ckeditor"  %>
	<%#= f.text_area :body %>
  </div>
  <div class="field">
    <%= f.label :published_at %><br>
    <%= f.datetime_select :published_at %>
  </div>
  <div class="actions">
    <%= submit_or_cancel(f) %>
  </div>
<% end %>


